public class lk2485 {
    public static void main(String[] args) {
        int n=8;
        int m=(n+1)*n/2;
        if(m%2==1){
            return -1;
        }
        int end = (int)Math.sqrt((double)m);
        return end*end==m?end:-1;
        System.out.println(end);

    }
    // public int pivotInteger(int n) {
        

    // }
}
